package LatentTicTacToe.Data;

import java.util.LinkedList;

/**
 * Abstract class with methods each board must implement
 * @author Jiri Cermak
 *
 */
public abstract class AbstractBoard {
	
	/**
	 * Id which is used to navigate through game tree.
	 * Root board has id 0.
	 * Every successor of given board appends "." and coordinates of move which created him, to his parents id. 
	 * Therefore is easy to navigate through game tree, because this id also serves as key in hashmap.
	 */
	public String id = "";
	
	/**
	 * 
	 * @return approximation of expected value of current board
	 */
	public abstract float evaluate(byte sign);
	
	
	/**
	 * return 1 - cross player won
	 * 		  2 - circle player won
	 * 		  0 - board is not terminal
	 * 		 -1 - tie
	 */
	public abstract byte isTerminal();
	
	/**
	 * return 1 - cross player won
	 * 		  2 - circle player won
	 * 		  0 - board is not terminal
	 * 		 -1 - tie
	 */
	public abstract byte isTerminalForMoves(Move parentMove, Move move, byte sign);
	
	/**
	 * Performs move
	 * @param move
	 * @param sign
	 */
	public abstract void makeMove(Move move, byte sign); 
	
	/**
	 * Undoes last move
	 * @param sign
	 */
	public abstract void reverseMove(); 
	
	/**
	 * 
	 * @return latent successors
	 */
	public abstract LinkedList<Move> getSuccessors();
	
	/**
	 * Checks if given move is valid
	 */
	public abstract boolean isValid(Move move);
	
	public abstract byte[][] getLatentSituation();
	
	public abstract AbstractBoard clone();
	
	public abstract int getGainForPlayer(byte sign);
	
	
}
